<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>导入贷款客户信息</title>
		<#include '/frame/version.html'>
		<#include '/frame/manage/include_css.html'>
		<#include '/frame/manage/include_js.html'>
		<script type="text/javascript" src="${basePath}/js/ajaxfileupload.js"></script>
		<#include '/frame/taglib.html'>
	</head>
	<body id="nv_member">
		<#assign current='menu_loan_info'>
		<div id="wp" class="wp">
			<#include "/include/header.html"/>
			<div class="contentmanage">
				<div class="developer">
					<div class="tableContent">
						<#include "/include/left.html"/>
						<#include "/include/wxtop.html"/>
						<div class="content">
							<div class="cLineB">
								<h4 style="font-size:16px;"><#if type==0>导入贷款客户信息<#elseif type==1>导入贷款处理结果信息</#if></h4>
								<div class="pageNavigator right">
		                			<a class="btnGray" type="button" href="${basePath}/admin/loan/index">返回</a>
		               			</div>
							</div>
							<form method="post" action="${basePath}/admin/loan/import" id="mainForm"  enctype="multipart/form-data">
								<input name="id" value="${bean.id}" type="hidden"/>
								<div class="msgWrap">
									<table class="userinfoArea" width="100%">
										<tbody>
											<tr>
												<th>
													<label for="input_keyword">下载模板：</label>
												</th>
												<td>
													<#if type==0>
														<a href="${basePath}/excel/cust_loan_info.xlsx" target="_self">点击下载模板</a>
														<#elseif type==1>
														直接上传导出处理后的excel
													</#if>
													
												</td>
											</tr>
											<tr>
												<th>
													<span class="red">*</span><label for="input_keyword">选择文件：</label>
												</th>
												<td>
													<input type="file" class="px input_width_500" name="file" id="memberfileid"/>
												</td>
											</tr>
											<tr>
												<th></th>
												<td>
												<#if type==0>
													<input type="button" value="执行导入" class="btnGreen left" id="input_save" onclick="ajaxFileUpload();"/>
													<#elseif type==1>
													<input type="button" value="执行导入" class="btnGreen left" id="input_save" onclick="ajaxFileUpload2();"/>
												</#if>
												</td>
											</tr>
										</tbody>
									</table>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
		</div>
		<#include "/include/footer.html"/>
<script type="text/javascript">
function ajaxFileUpload() {
	var $file = $(":file");
	if($file.val()==""){
		stem.tip("请选择文件！",$file[0]);
		return false;
	}
	
    $.ajaxFileUpload({
        url : '${basePath}/admin/loan/import',
        secureuri : false,
        fileElementId : 'memberfileid',
        dataType : 'json',
        data : {},
        success : function(data) {
                if (data!=null&&data.code == 'success') {
                    alert("导入客户贷款信息成功！");
                	location.href="${basePath}/admin/loan/index";
                } else {
                    $("#memberfileid").attr("value","");
                    alert(data.msg);
                }
           
        }
    });
    return false;
}


function ajaxFileUpload2() {
	var $file = $(":file");
	if($file.val()==""){
		stem.tip("请选择文件！",$file[0]);
		return false;
	}
	
    $.ajaxFileUpload({
        url : '${basePath}/admin/loan/import/update',
        secureuri : false,
        fileElementId : 'memberfileid',
        dataType : 'json',
        data : {},
        success : function(data) {
                if (data!=null&&data.code == 'success') {
                    alert("导入贷款处理结果成功！");
                	location.href="${basePath}/admin/loan/index";
                } else {
                    $("#memberfileid").attr("value","");
                    alert(data.msg);
                }
           
        }
    });
    return false;
}

</script>
	</body>
</html>